#! /usr/bin/env python
"""
Convert a batch of image file sequences to QuickTime movies.

Edit this file and list your sequences below.

Author: Chip Chapin <cchapin@gmail.com>
For More Info: http://code.google.com/p/seq-to-qt/
Latest Update: 2010-02-03
"""
import seq_to_qt

DEFAULT_BASE_PATH = "E:\\Images\\SX110\\MTV-TL01"
DEFAULT_SEQUENCE_FILE = "MTV-TL01_0001.JPG"
DEFAULT_CHUNK_SIZE = 7000

def usage():
    print "Usage: seq_batch_convert.py "
    exit(2)
    
def main(argv):
    """Main Program"""
    # Step 1: Base directory.  This is the parent of your
    # sequence directories.
    base_path = DEFAULT_BASE_PATH
    
    # Step 2: List your image sequences.
    # Each sequence is a duple containing the
    # FOLDER NAME and the STARTING IMAGE of the sequence
    # Example:
    sequences =  [("2010-01-14-1", "MTV-TL01_0001.JPG"),
                  ("2010-01-14-2", "MTV-TL01_7001.JPG"),
                  ("2010-01-15", "MTV-TL01_0001.JPG"),
                  ("2010-01-16", "MTV-TL01_0001.JPG"),
                  ("2010-01-17", "MTV-TL01_0001.JPG"),
                  ("2010-01-19", "MTV-TL01_0001.JPG"),
                  ("2010-01-20", "MTV-TL01_0001.JPG"),
                  ("2010-01-21", "MTV-TL01_0001.JPG"),
                  ("2010-01-22", "MTV-TL01_0001.JPG"),
                  ("2010-01-25", "MTV-TL01_0001.JPG"),
                  ("2010-01-26", "MTV-TL01_0001.JPG"),
                  ("2010-01-27", "MTV-TL01_0001.JPG"),
                  ("2010-01-28", "MTV-TL01_0001.JPG"),
                  ("2010-01-29", "MTV-TL01_0001.JPG"),
                  ("2010-02-01", "MTV-TL01_0001.JPG"),
                  ("2010-02-02", "MTV-TL01_0001.JPG"),
                  ("2010-02-03", "MTV-TL01_0001.JPG"),
                  ("2010-02-04", "MTV-TL01_0001.JPG"),
                  ("2010-02-05", "MTV-TL01_0001.JPG")
                  ]

    # Step 3: How many frames per second should your movie run at?
    frame_rate = 60

    # Step 4: Movie chunk size-- how large a movie (how many frames)
    # can QuickTime process on your computer?  Try the default.
    # If QuickTime aborts during the export phase, make it smaller.
    # chunk_size = 75  # Low value for testing. Normally use DEFAULT_CHUNK_SIZE
    chunk_size = DEFAULT_CHUNK_SIZE

    # Now do the conversion.
    seq_to_qt.convert_sequences(base_path,
                                sequences,
                                frame_rate,
                                chunk_size)
    
if __name__ == "__main__":
    import sys
    main(sys.argv)
